package com.heima.test.job;

import com.xxl.job.core.biz.model.ReturnT;
import com.xxl.job.core.handler.annotation.XxlJob;
import org.springframework.stereotype.Component;
import java.time.LocalDateTime;
import java.util.ArrayList;
import java.util.List;

/**
 * @author mrchen
 * @date 2022/7/14 15:56
 */
@Component
public class EatJob {
//    @Scheduled(cron = "*/5 * * * * ?")
    @XxlJob("helloJob")
    public void eat() throws Exception{
        System.out.println("该吃饭了，小可爱  ==>" + LocalDateTime.now().toString());
    }
    @XxlJob("demoJobHandler")
    public void demoJobHandler() throws Exception {
    }
    /**
     * 2、分片广播任务
     */
    @XxlJob("shardingJobHandler")
    public ReturnT<String> shardingJobHandler(String param) throws Exception {
        return ReturnT.SUCCESS;
    }

    public static List<Integer> getList(){
        List<Integer> list = new ArrayList<>();
        for (int i = 0; i < 10000 ; i++) {
            list.add(i);
        }
        return list;
    }
}
